#! /usr/bin/env python
from script import data

__author__ = 'awh'
import time
import web

render=web.template.render('templates/')

urls=(
    "","guestbook",
    "/","guestbook",
)

app=web.application(urls,locals())

class guestbook(object):
    def GET(self):
        comments= data.comment.all()
        return render.guestbook(comments)
        #print 'aaaa'
    def POST(self):
        i=web.input()
        if i.author and i.content:
            lactation=time.localtime(time.time())
            st=time.strftime('%Y-%m-%d %X',lactation)
            m= data.comment(author=i.author,content=i.content,t=st)
            m.put()
        raise web.seeother("/")